from sklearn.neighbors import KNeighborsClassifier


# 0. 收集数据
x = [[0], [1], [2], [3], [4]]
y = [0, 0, 1, 1, 1]

# 1. 实例化API
estimator = KNeighborsClassifier(n_neighbors=3)

# 2. 机器学习
estimator.fit(x, y)

# 3. 预测未来
ret = estimator.predict([[10]])
print(ret)

